import { Article } from 'src/modules/article/entities/article.entity';
import { Comment } from 'src/modules/comment/entities/comment.entity';
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';

@Entity()
export class User {
  @PrimaryGeneratedColumn("uuid")
  userid: string;

  @Column()
  username: string;

  @Column()
  password: string;

  @Column({ default: '1' })
  sex: string;
  @Column({ default: '18' })
  age: string;
  @Column({ default: '这个人很神秘，什么都没有留下' })
  description: string;
  
  @Column({ default: '123@qq.com' })
  email: string;
  @Column()
  avatarUrl: string;

  @Column({ default: '1' })
  roles: string;

  //默认是true
  @Column({ default: true })
  isActive: boolean;

  @OneToMany(() => Article, (article) => article.user)
  articles: Article[];

  @OneToMany(() => Comment, (comment) => comment.user)
  comments: Comment[];
}
